.TH "LIGHTNING-OPENCHANNEL_INIT" "7" "" "" "lightning-openchannel_init"
.SH NAME
lightning-openchannel_init - Command to initiate a channel to a peer
.SH SYNOPSIS

\fBopenchannel_init\fR \fIid\fR \fIamount\fR \fIinitalpsbt\fR [\fIcommitment_feerate\fR] [\fIfunding_feerate\fR] [\fIannounce\fR] [\fIclose_to\fR]

.SH DESCRIPTION

\fBopenchannel_init\fR is a low level RPC command which initiates a channel
open with a specified peer\. It uses the openchannel protocol
which allows for interactive transaction construction\.


\fIid\fR is the node id of the remote peer\.


\fIamount\fR is the satoshi value that we will contribute to the channel\.
This value will be \fIadded\fR to the provided PSBT in the output which is
encumbered by the 2-of-2 script for this channel\.


\fIinitialpsbt\fR is the funded, incomplete PSBT that specifies the UTXOs and
change output for our channel contribution\. It can be updated,
see \fBopenchannel_update\fR; \fIinitialpsbt\fR must have at least one input to
provide a PoDLE to the peer\.  Must have the Non-Witness UTXO
(PSBT_IN_NON_WITNESS_UTXO) set for every input\. An error
(code 309) will be returned if this requirement is not met\.


\fIcommitment_feerate\fR is an optional field\. Sets the feerate for
commitment transactions: see \fBfundchannel\fR\.


\fIfunding_feerate\fR is an optional field\. Sets the feerate for the 
funding transaction\. Defaults to 'opening' feerate\.


\fIannounce\fR is an optional field\. Whether or not to announce this channel\.


\fIclose_to\fR is a Bitcoin address to which the channel funds should be
sent on close\. Only valid if both peers have negotiated 
\fBoption_upfront_shutdown_script\fR\.

.SH RETURN VALUE

On success, returns the \fIchannel_id\fR for this channel; an updated
incomplete \fIinitialpsbt\fR for this funding transaction; and the flag
\fIcommitments_secured\fR, which indiciates the completeness of the 
passed back \fIpsbt\fR\. (Will always be false)\. Also returns the
\fIfunding_serial\fR, indicating the serial_id of the funding output
in the \fIpsbt\fR\.


If the peer does not support \fBoption_dual_fund\fR, this command
will return an error\.


On error the returned object will contain \fBcode\fR and \fBmessage\fR properties,
with \fBcode\fR being one of the following:

.RS
.IP \[bu]
-32602: If the given parameters are wrong\.
.IP \[bu]
-1: Catchall nonspecific error\.
.IP \[bu]
300: The amount exceeded the maximum configured funding amount\.
.IP \[bu]
301: The provided PSBT cannot afford the funding amount\.
.IP \[bu]
304: Still syncing with bitcoin network
.IP \[bu]
305: Peer is not connected\.
.IP \[bu]
306: Unknown peer id\.
.IP \[bu]
309: PSBT missing required fields
.IP \[bu]
310: v2 channel open protocol not supported by peer

.RE
.SH SEE ALSO

lightning-openchannel_\fBupdate\fR(7), lightning-openchannel_\fBsigned\fR(7),
lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcomplete\fR(7),
\fBlightning-fundchannel\fR(7), \fBlightning-fundpsbt\fR(7), \fBlightning-utxopsbt\fR(7),
\fBlightning-multifundchannel\fR(7)

.SH AUTHOR

@niftynei \fI<niftynei@gmail.com\fR> is mainly responsible\.

.SH RESOURCES

Main web site: \fIhttps://github.com/ElementsProject/lightning\fR

\" SHA256STAMP:d73cf35c01e641d80688352058111421d9213b0a23043e9cdc807398442efd7a
